<?php
	/**
	* Classe Model da tag
	* @author Aldo Romero
	*/
	
	class Tag extends AppModel {
		public $name = "Tag";
		public $useTable = "tags";

		
		//retorna todas as tags do banco
		public function tags() {
			$tag = $this->query("SELECT id, name from tags order by name");
			return $tag;
		}
		//retorna as tags da comunidade
		public function tagsCmm($idCmm) {
			$tag = $this->query("SELECT tags.name from communities_tags, tags where tags.id = communities_tags.tag_id and communities_tags.community_id = '".$idCmm."'");
			if ($tag){
				return $tag[0]['tags']['name'];
			}else
			{return '';
			}
		}
	}
?>